home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9962 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  831 b 

  1. Path: cea.fr!usenet
  2. From: Buteau <buteau@bali.saclay.cea.fr>
  3. Newsgroups: comp.lang.c++
  4. Subject: How to know the exact status of fstreams
  5. Date: 5 Mar 1996 11:56:58 GMT
  6. Organization: CEA CEN (Commissarait a l'energie atomique)
  7. Message-ID: <4hha6a$2vg@news.cea.fr>
  8. NNTP-Posting-Host: bali.saclay.cea.fr
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.5 sun4m)
  13. X-URL: news:comp.lang.c++
  14.  
  15. When I open a file with something like :
  16.  
  17. ofstream oss(myfile.txt);
  18.  
  19.  
  20. If this open fails (which I generally test with a 
  21.  
  22. if (!oss) 
  23. { blah blah ......
  24.  
  25. I would like to know the exact reason of the open failure
  26. (disk full, unautorizhed access to the file, ....)
  27.  
  28. Can I do it with the fstream status ?
  29. And if not  are there some "standard" or idiomatic solution
  30.  
  31.